package InputOutputStreamDemo;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class FileReaderTest {
    public static void main(String[] args) throws FileNotFoundException {
        //创建一个文件字符输入流管道与源文件接通
        try (
            FileReader fr = new FileReader("D:\\Demo-Java\\java-demo-hbnu\\src\\aa.txt");
        ){
//            int c;//记住每次读取的字符编号
//            while ((c=fr.read())!=-1){
//                System.out.print((char) c);
            char[] buffer = new char[3];
            int len;
            System.out.println();
            while((len=fr.read(buffer))!=-1){
                System.out.print(new String(buffer, 0, len));

            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
